﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace serie02_3_geometricObjects
{
    class Triangle : GeometricObject
    {
        protected override void specialPaint(System.Windows.Forms.PaintEventArgs e)
        {
            // Pen + Rectangle
            System.Drawing.Pen pen = new System.Drawing.Pen(System.Drawing.Color.Green);

            // Dreieck
            int xLeft = 1;
            int xMiddle = (this.Width - 2) / 2;
            int xRight = this.Width - 2;
            int yTop = 1;
            int yBottom = this.Height - 2;

            System.Drawing.Point[] points = new System.Drawing.Point[4];
            
            points[0] = new System.Drawing.Point();
            points[0].X = xLeft;
            points[0].Y = yBottom;

            points[1] = new System.Drawing.Point();
            points[1].X = xMiddle;
            points[1].Y = yTop;

            points[2] = new System.Drawing.Point();
            points[2].X = xRight;
            points[2].Y = yBottom;

            points[3] = new System.Drawing.Point();
            points[3].X = xLeft;
            points[3].Y = yBottom;

            e.Graphics.DrawPolygon(pen, points);
        }
    }
}
